package day20180129.designMode.eight_AbstratFactory;

/**
 * Created by 14394 on 2018/1/29.
 */
//抽象的工厂类
public abstract class Factory {

    public static Factory getFactory(String classname){
        Factory factory = null;
        try {
            factory = (Factory) Class.forName(classname).newInstance();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        return  factory;
    }

    public abstract Link createLink(String caption,String url);

    public abstract  Tray createTray(String caption);

    public abstract Page createPage(String title,String author);


}
